package com.smedi.ismedi.constructionproject.core.port.adapter.persistence.repository.impl;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.smedi.ismedi.authority.starter.util.AuthorityUtil;
import com.smedi.ismedi.constructionproject.core.domain.aggregatemodel.Person;
import com.smedi.ismedi.constructionproject.core.domain.aggregatemodel.ProjectBasic;
import com.smedi.ismedi.constructionproject.core.domain.repository.PersonBasicRepository;
import com.smedi.ismedi.constructionproject.core.port.adapter.persistence.model.ProjectBasicEntity;
import com.smedi.ismedi.constructionproject.core.port.adapter.restful.convert.AdapterConverter;
import com.smedi.ismedi.constructionproject.core.port.adapter.service.PersonnelRemoteApiService;
import com.smedi.ismedi.personnel.api.dto.response.PersonSimpleResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-6-18 15:54
 */
@Slf4j
@Repository
@AllArgsConstructor
public class PersonBasicRepositoryImpl implements PersonBasicRepository {
    private final AdapterConverter adapterConverter;
    private final AuthorityUtil authorityUtil;

    private final PersonnelRemoteApiService personnelRemoteApiService;

    @Override
    public List<Person> selectByPersonIds(List<Long> personIds) {
        List<PersonSimpleResponse> personSimpleResponses = personnelRemoteApiService.getPersonSimpleInfoByPersonIds(personIds);

        return adapterConverter.personSimpleResponsesToPersons(personSimpleResponses);
    }

}
